package main

import (
	"fmt"
	"log"
)

func main() {
	//动态数组 切片slice
	myArray := []int{1, 2, 3, 4}
	fmt.Printf("%T\n", myArray)
	fmt.Println(myArray)
	modify(myArray)
	for _, value := range myArray {
		log.Println("value=", value)
	}

}

// modify 切片是 引用传递
func modify(myArray []int) {
	myArray[0] = 601088
}

//arrDemo 数组|值拷贝
func arrDemo() {
	//定义数组
	var myArr [10]int
	for i := 0; i < len(myArr); i++ {
		fmt.Println(myArr[i])
	}
	fmt.Println(myArr)

	myarr2 := [10]int{1, 2, 3}
	for i, i2 := range myarr2 {
		fmt.Println("index ", i, ", value ", i2)
	}
	fmt.Printf("%T\n", myarr2)
}
